const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    companyList: []
  },

  getData() {
    wx.showLoading({
      title: "获取中..."
    });
    wx.$apis.getMyUserInfo().then((res) => {
      if (res.data) {
        const companyList = res.data;
        this.setData({
          companyList
        });
      }
    });
  },

  onShow() {
    this.getData();
  },

  toDetail(e) {
    let Index = e.currentTarget.dataset.index;
    if (Index > -1) {
      wx.setStorage({
        key: "cardCode",
        data: {
          cardCode: this.data.companyList[Index].cardCode
        }
      })
		} else {
			wx.showToast({
				title: '数据异常稍后再试!',
				icon: 'none'
			})
		}
  }
});
